package com.myrock.zlbandy.gorock.rock.ui;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.myrock.zlbandy.gorock.rock.z.MyRock;
import com.myrock.zlbandy.gorock.HttpModel.Model.RockInfo;
import com.myrock.zlbandy.gorock.R;

/**
 * A simple {@link Fragment} subclass.
 */
public class BlankFragment extends Fragment {
private  RockInfo rockInfo;
    private  TextView name,chinese,formula,density,hardness,color,dana,crystal;


    public BlankFragment() {
        // Required empty public constructor
    }
    public void init(RockInfo rockInfo){
        this.rockInfo = rockInfo;
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View chatView = inflater.inflate(R.layout.info_layout, container,false);
        name = (TextView)chatView.findViewById(R.id.name);
        chinese = (TextView)chatView.findViewById(R.id.chinese);
        formula = (TextView)chatView.findViewById(R.id.formula);
        density = (TextView)chatView.findViewById(R.id.density);
        hardness = (TextView)chatView.findViewById(R.id.hardness);
        color = (TextView)chatView.findViewById(R.id.color);
        dana = (TextView)chatView.findViewById(R.id.dana);
        crystal = (TextView)chatView.findViewById(R.id.crystal);


        name.setText(rockInfo.getName());
        chinese.setText(rockInfo.getChinese());
        formula.setText(MyRock.String2Formula(rockInfo.getFormula()));
        density.setText(rockInfo.getDensity());
        hardness.setText(rockInfo.getHardness());
        color.setText(rockInfo.getColor());
        dana.setText(rockInfo.getDana()==null?"":rockInfo.getDana());
        crystal.setText(rockInfo.getCrystal());


        return chatView;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState){
        super.onActivityCreated(savedInstanceState);
    }

}
